package com.demo.web.admin.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.curator.shaded.com.google.common.collect.Maps;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.bluering.framework.FrameworkInvoker;
import com.bluering.framework.common.log.Logger;
import com.bluering.inf.entity.RespEntity;
import com.demo.web.admin.form.FormResp;
import com.demo.web.admin.service.FrameworkInvokerUtil;
import com.demo.web.admin.service.PayService;

@Controller
public class IndexController extends BaseController{
	
	private static Logger logger =Logger.getLogger(IndexController.class);
	

	
	@Autowired
	private PayService payService;
	
	@Autowired
	private FrameworkInvoker frameworkInvoker;


	
	@RequestMapping("/index")
    public ModelAndView index(HttpServletRequest req){
       ModelAndView mv = new ModelAndView("index");
       return mv;
    }
	
	
	
	@RequestMapping("/pay")
	@ResponseBody
	public Object pay2(String channelCode,String acquirerCode) {
//		frameworkInvoker.invoke("", "0.0.1", null);
		Map<String,String> param = Maps.newConcurrentMap();
		param.put("channelCode",channelCode);
		param.put("acquirerCode", acquirerCode);
		param.put("paramType", "01");
		JSONObject json = FrameworkInvokerUtil.invoke("MER002", "1.0", param);
		JSONObject data = json.getJSONObject("data");
		Object obj = data.get("parameter");
		JSONObject p = data.getJSONObject("parameter");
		return json;
	}
	

}
